package remotecontrolcase;

import remotecontrolcase.command.ceilingfan.CeilingFanOffCommand;
import remotecontrolcase.command.ceilingfan.CeilingFanOnCommand;
import remotecontrolcase.command.garagedoor.GarageDoorCloseCommand;
import remotecontrolcase.command.garagedoor.GarageDoorOpenCommand;
import remotecontrolcase.command.light.LightOffCommand;
import remotecontrolcase.command.light.LightOnCommand;
import remotecontrolcase.command.stereo.StereoOffCommand;
import remotecontrolcase.command.stereo.StereoOnCommand;
import remotecontrolcase.component.CeilingFan;
import remotecontrolcase.component.GarageDoor;
import remotecontrolcase.component.Light;
import remotecontrolcase.component.Stereo;

/**
 * description:
 *  遥控器案例
 * @author yuanmenglv on 2019/11/30
 */
public class Client {
    public static void main(String[] args) {
        RemoteControll remoteControll = new RemoteControll();
        Light light = new Light();
        GarageDoor garageDoor = new GarageDoor();
        Stereo stereo = new Stereo();
        CeilingFan ceilingFan = new CeilingFan();

        remoteControll.setCommand(0, new LightOnCommand(light), new LightOffCommand(light));
        remoteControll.setCommand(1, new GarageDoorOpenCommand(garageDoor), new GarageDoorCloseCommand(garageDoor));
        remoteControll.setCommand(2, new StereoOnCommand(stereo), new StereoOffCommand(stereo));
        remoteControll.setCommand(3, new CeilingFanOnCommand(ceilingFan), new CeilingFanOffCommand(ceilingFan));

        remoteControll.buttonWasPushed(1);
        remoteControll.buttonWasUnpushed(1);

        remoteControll.buttonWasPushed(2);
    }
}
